<?php
/**
 * Object Relational Persistence Mapping Class for table: rad_group
 *
 * @package	com.athena
 * @author	LHV
 */
class RadGroup extends ORDataObject {

	/**#@+
	 * Fields of table: rad_group mapped to class members
	 */
	var $rad_group_id	        = '';
	var $vi_name				= '';
	var $en_name				= '';
	var $enum_paraclinic_type	= '';
	/**#@-*/


	/**
	 * DB Table
	 */
	var $_table = 'rad_group';

	/**
	 * Primary Key
	 */
	var $_key = 'rad_group_id';

	/**
	 * Internal Name
	 */
	var $_internalName = 'RadGroup';

	/**
	 * Handle instantiation
	 */
	function RadGroup() {
		parent::ORDataObject();
	}

	/**
	 * Get radiology service groups by given radiology type enumeration value, or get all groups.
	 *
	 * @param int $enumRadType Radiology type enumeratio value
	 * @return array Group list
	 */
    public function getRadGroupsByEnumRadType($enumRadType, $toArrayKeyValue = true){    	
    	$field		= 	L10nHelper::changeField(L10nHelper::getLocale() ,"name");
        
        $ds =& new Datasource_sql();
        $sql = array(
            'cols'      =>  "rad_group_id id, $field name, enum_paraclinic_type",
            'from'      =>  "$this->_table",
            'orderby'   =>  "enum_paraclinic_type, $field"
            );
        if ($enumRadType !== false) {
            $sql['where']   =   "enum_paraclinic_type='$enumRadType'";
        }
        $ds->setup($this->_db, $sql);
        if ($toArrayKeyValue) {
            return $ds->toArray('id', 'name');
        }
        return $ds->toArray();
    }

    public function getName() {
    	return $this->name;
    }

    public function getEnumParaClinicType() {
    	return $this->enum_paraclinic_type;
    }

}
?>
